#-------------------------------------------------
#
# Project created by Vacant 2014-05-02T23:32:58
#
#-------------------------------------------------
TARGET = Fish_project
TEMPLATE = app

#DLLDESTDIR = $$[QT_INSTALL_BINS]
ORGDESTDIR = $$OUT_PWD
DESTDIR = $$OUT_PWD/bin
MOC_DIR = $$OUT_PWD/temp/moc
RCC_DIR = $$OUT_PWD/temp/rcc
UI_DIR = $$OUT_PWD/temp/ui
OBJECTS_DIR = $$OUT_PWD/temp/obj

DLLDESTDIR = $$OUT_PWD/bin

QT       += core gui sql network axcontainer
CONFIG   += static warn_off

#QTPLUGIN += qcncodecs qjpcodecs qkrcodecs qtwcodecs qico

CONFIG   += c++11

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

#add flag to build the pdb file in release
QMAKE_CFLAGS_RELEASE    = -O2 -MD -zi
QMAKE_LFLAGS_RELEASE    = /INCREMENTAL:NO /DEBUG
#end.

win32{
    COPY = copy /y
    MKDIR = mkdir
}else{
    COPY = cp
    MKDIR = mkdir -p
}
PATHOFLIB=$$ORGDESTDIR/lib
win32:PATHOFLIB ~= s,/,\\,g
#!exists($$PATHOFLIB):system($$MKDIR $$PATHOFLIB)
#QMAKE_RPATHDIR += $$PATHOFLIB
#QMAKE_RPATHDIR += :\'\$\$PATHOFLIB\'

#QMAKE_LFLAGS += -Wl,-rpath,$$PATHOFLIB

defineTest(copyToDestdir){
    files = $$1
    DSTDIR = $$2

    for(FILE, files) {
        DDIR = $$DSTDIR
#message("VacantCopyFun:" $$FILE $$DDIR)

        # Replace slashes in paths with backslashes for Windows
        win32:FILE ~= s,/,\\,g
        win32:DDIR ~= s,/,\\,g

        QMAKE_POST_LINK += $$QMAKE_COPY $$quote($$FILE) $$quote($$DDIR) $$escape_expand(\\n\\t)
    }
    export(QMAKE_POST_LINK)
}

TRANSLATIONS +=\
    res/lang/FishProject_zh_CN.ts

win32-msvc*:LIBS += -lole32 -lshell32 -ladvapi32 -lcomctl32

win32 {
    DEFINES += _CRT_SECURE_NO_WARNINGS
    !contains(QMAKE_TARGET.arch, x86_64) {
        #message("win32 build")
        ARCH = Win32## Windows x86 (32bit) specific build here
    } else {
        #message("x64 build")
        ARCH = x64 ## Windows x64 (64bit) specific build here
    }

    CONFIG(debug, debug|release): BUILD = debug

    CONFIG(release, debug|release){
        BUILD=release
        #DEFINES += QT_NO_DEBUG_OUTPUT
        #DEFINES += QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT QT_NO_DEBUG_STREAM
    }
    LIBS += $$PWD/../libs/breakpad/$$ARCH/$$BUILD/breakpad-qt-handler.lib
    LIBS += $$PWD/../libs/Simple/$$ARCH/$$BUILD/Simple.lib
    INCLUDEPATH +=  $$PWD/../includes/breakpad/handler
    INCLUDEPATH +=  $$PWD/../includes/Simple
#    copyToDestdir($$PWD/../libs/Simple/$$ARCH/$$BUILD/Simple.dll,$$DESTDIR)

#    message($$DESTDIR : $$PWD/../includes/Simple)

#    LIBS += $$PWD/libs/libxl/libxl.lib
    #LIBS += $$PWD/../libs/Simple/$$ARCH/$$BUILD/Simple.lib
#    LIBS += -lkernel32
#    INCLUDEPATH +=  $$PWD/includes/libxl
    #INCLUDEPATH +=  $$PWD/../includes/Simple

QT += winextras
}

!equals(_PRO_FILE_PWD_/bin, OUT_PWD/bin) {
#    copyToDestdir($$_PRO_FILE_PWD_/bin/driver.exe,$$DESTDIR)
    copyToDestdir($$PWD/../libs/Simple/$$ARCH/$$BUILD/Simple.dll,$$DESTDIR)
    message(win32/$$QMAKE_TARGET.arch/$$ARCH/$$BUILD : $$DESTDIR : $$PWD/../libs/Simple/$$ARCH/$$BUILD/Simple.dll)
}
#!equals(_PRO_FILE_PWD_/lib, ORGDESTDIR/lib)
#{
#    platform = mingw
#    win32-msvc*:platform = msvc
#    copyToDestdir($$_PRO_FILE_PWD_/lib/$$platform/$$BUILD,$$DESTDIR)
#}

QMAKE_CLEAN += $$DESTDIR/*.dll

SOURCES += main.cpp\
        widget.cpp \
    excelengine.cpp \
    ui/formsetting.cpp \
    utils/datamanager.cpp \
    loadingwidget.cpp \
    excelthread.cpp \
    application.cpp \
    client/client.cpp \
    client/clientthread.cpp \
    utils/winmanager.cpp \
    utils/gloweffect.cpp \
    ui/formaddgroup.cpp \
    ui/basewidget.cpp \
    ui/formrecordcontrol.cpp \
    ui/formtoolboxwidget.cpp \
    ui/formitemwidgetgroup.cpp \
    ui/formitemwidgetgroupsub.cpp \
    ui/formtoolboxinfowidget.cpp \
    utils/excelhandle.cpp \
    utils/groupitemdata.cpp \
    jsonhelp.cpp \
    ui/formviewrecord.cpp

HEADERS  += \
    widget.h \
    excelengine.h \
    ui/formsetting.h \
    utils/datamanager.h \
    send.h \
    loadingwidget.h \
    excelthread.h \
    application.h \
    client/client.h \
    client/clientthread.h \
    utils/CallOnce.h \
    utils/Singleton.h \
    utils/winmanager.h \
    utils/gloweffect.h \
    ui/formaddgroup.h \
    ui/basewidget.h \
    ui/formrecordcontrol.h \
    ui/formtoolboxwidget.h \
    ui/formitemwidgetgroup.h \
    ui/formitemwidgetgroupsub.h \
    ui/formtoolboxinfowidget.h \
    utils/excelhandle.h \
    utils/groupitemdata.h \
    jsonhelp.h \
    ui/formviewrecord.h

FORMS    += widget.ui \
    ui/formsetting.ui \
    ui/formaddgroup.ui \
    ui/formrecordcontrol.ui \
    ui/formtoolboxwidget.ui \
    ui/formitemwidgetgroup.ui \
    ui/formitemwidgetgroupsub.ui \
    ui/formtoolboxinfowidget.ui \
    ui/formviewrecord.ui

RESOURCES += \
    Res.qrc

win32:RC_FILE += \
    res/program.rc

OTHER_FILES += \
    res/program.rc
